<?php

namespace App\Http\Requests\API;

use InfyOm\Generator\Request\APIRequest;

class UpdateUserAPIRequest extends APIRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'bail|string|max:64|unique:users,name,'.$this->route('user'),
            'true_name' => 'string|max:64',
            'password' => 'string:max:64',
            'email' => 'bail|email|unique:users,email,'.$this->route('user'),
            'phone' => 'bail|unique:users,phone,'.$this->route('user'),
            'roles' => 'bail|array|exists:roles,id',
            'organization_id' => 'exists:organizations,id',
            'flag' => 'integer'
        ];
    }
}
